The present invention relates to a portable electronic device, a so-called IC card, which incorporates an IC (integrated circuit) chip having a nonvolatile data memory and a control element, e.g., a CPU (Central Processing Unit).
In recent years, an IC card incorporating an IC chip having a nonvolatile memory (e.g., PROM) and a CPU has been developed as a memory card for storing data and is commercially available. In a system using an IC card of this type, data exchange with the IC card is made by a card reader/writer. When the IC card receives instruction data with a function code from the card reader/writer, it executes a function and outputs the execution result to the card reader/writer as response data.
When a data string input to the IC card is written in the data memory, the input data may be written only after an unwritten area in which no valid data is written is first certified. In this case, when a plurality of data strings are successively written, if address data of the next area (for example, a start address of unwritten area) in which data is to be written is not stored, an unwritten area must first be certified each time the data string is written, resulting in a long total write time.
In a conventional IC card, when a data string is written in a target area, it is written from a given reference address (e.g., a start address) in a single direction, and a final address of the written data string is stored in a RAM (Random Access Memory) in a control element, thus simplifying the subsequent write operation. More specifically, when a power supply of the IC card is turned on, the above simplification can be realized. However, after the power supply is temporarily turned off and is turned on again to perform a write operation, the content of the RAM is erased. Therefore, the final address must be searched from the target area. In this case, a specific value, e.g., "FF.sub.H ", must be held as data for certifying unwritten data. For this reason, data write speed is considerably decreased.